#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>

const int kTableSize = 100;

typedef struct KeyValueStruct {
    char* key;
    char* value;
    struct KeyValueStruct* next;
} KeyValue;

typedef struct HashTableStruct {
    KeyValue **data;
    int size;
} HashTable;

// Creates a new hash table with size slots.
HashTable *create(int size);
// Frees memory associated with given hash table.
void destroy(HashTable *hashTable);
// Universal string hashing algorithm
int hash(const char* key, const int m);
// Outputs the content of the hash table
void printDebug(HashTable *table);
// Returns true if the given key exists in the table
bool exists(const HashTable * table, const char* key);
// Removes the value associated with key from the table.
void delete(HashTable *table, const char *key);

KeyValue *get(const HashTable *table, const char* key);
// Add the given key and object to hash table. If key exists, update the value.
void add(HashTable *table, KeyValue *object);